卸载

查看已经安装的jdk

1
2
3
4
5
[root@bogon jre]# rpm -qa|grep jdk
java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64
java-1.7.0-openjdk-1.7.0.91-2.6.2.3.el7.x86_64
java-1.7.0-openjdk-headless-1.7.0.91-2.6.2.3.el7.x86_64
java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_6412345

卸载命令

1
[root@bogon jre]# yum -y remove java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_641

卸载完成之后Java命令不被识别

1
2
[root@bogon lib]# java -version
bash: java: command not found...12

安装

去官网下载jdk:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
解压到安装目录

1
[root@bogon software]# tar -zxvf jdk-8u101-linux-x64.tar.gz -C /usr/local/java/

安装完毕之后在/etc/profile文件末尾添加

1
2
3
4
5
[root@bogon software]# vim /etc/profile
export JAVA_HOME=/usr/local/java/jdk1.8.0_181
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

使/etc/profile生效

1
[root@bogon jdk1.8.0_101]# source /etc/profile

检测安装是否成功

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
[root@bogon jdk1.8.0_101]# java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
[root@bogon jdk1.8.0_101]# javac
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath <path> Specify where to find user class files and annotation processors
-cp <path> Specify where to find user class files and annotation processors
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-endorseddirs <dirs> Override location of endorsed standards path
-proc:{none,only} Control whether annotation processing and/or compilation is done.
-processor <class1>[,<class2>,<class3>...] Names of the annotation processors to run; bypasses default discovery process
-processorpath <path> Specify where to find annotation processors
-parameters Generate metadata for reflection on method parameters
-d <directory> Specify where to place generated class files
-s <directory> Specify where to place generated source files
-h <directory> Specify where to place generated native header files
-implicit:{none,class} Specify whether or not to generate class files for implicitly referenced files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-profile <profile> Check that API used is available in the specified profile
-version Version information
-help Print a synopsis of standard options
-Akey[=value] Options to pass to annotation processors
-X Print a synopsis of nonstandard options
-J<flag> Pass <flag> directly to the runtime system
-Werror Terminate compilation if warnings occur
@<filename> Read options and filenames from file

https://www.cnblogs.com/zhongkaiuu/p/BC.html
问题:JCE cannot authenticate the provider BC

1
2
3
1. 找到 java.security 在jvm安装地方 /path_to_your_jvm/jre/lib/security
security.provider.9=org.bouncycastle.jce.provider.BouncyCastleProvider
3. 添加 bcprov-jdk16-146.jar到 /path_to_your_jvm/jre/lib/ext (提供maven的地址)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
[webadmin@wenhuatest2250 security]$ pwd
/usr/local/jdk1.6.0_45/jre/lib/security
[webadmin@wenhuatest2250 security]$ ll
total 116
-rw-r--r--. 1 webadmin webadmin 2177 Mar 27 2013 blacklist
-rw-r--r--. 1 webadmin webadmin 81202 Mar 27 2013 cacerts
-rw-r--r--. 1 webadmin webadmin 2253 Mar 27 2013 java.policy
-rw-r--r--. 1 webadmin webadmin 13481 Jul 31 18:15 java.security
-rw-r--r--. 1 webadmin webadmin 109 Mar 27 2013 javaws.policy
-rw-r--r--. 1 webadmin webadmin 2940 Mar 27 2013 local_policy.jar
-rw-r--r--. 1 webadmin webadmin 0 Mar 27 2013 trusted.libraries
-rw-r--r--. 1 webadmin webadmin 2469 Mar 27 2013 US_export_policy.jar
[webadmin@wenhuatest2250 security]$ stat java.security
File: ‘java.security’
Size: 13481 Blocks: 32 IO Block: 4096 regular file
Device: fd01h/64769d Inode: 6508959 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/webadmin) Gid: ( 1000/webadmin)
Context: unconfined_u:object_r:usr_t:s0
Access: 2019-08-22 09:15:39.110675245 +0800
Modify: 2019-07-31 18:15:20.880153567 +0800
Change: 2019-07-31 18:15:20.904165564 +0800
Birth: -

[webadmin@wenhuatest2250 ext]$ pwd
/usr/local/jdk1.6.0_45/jre/lib/ext
[webadmin@wenhuatest2250 ext]$ ll
total 3192
-rw-r--r--. 1 webadmin webadmin 1997327 Jul 31 17:43 bcprov-jdk15on-1.47.jar
-rw-r--r--. 1 webadmin webadmin 8238 Mar 27 2013 dnsns.jar
-rw-r--r--. 1 webadmin webadmin 845352 Jul 8 16:36 localedata.jar
-rw-r--r--. 1 webadmin webadmin 429 Mar 27 2013 meta-index
-rw-r--r--. 1 webadmin webadmin 170315 Mar 27 2013 sunjce_provider.jar
-rw-r--r--. 1 webadmin webadmin 232338 Mar 27 2013 sunpkcs11.jar

Comments